package com.grwx.omc.util;


import org.apache.commons.lang.StringUtils;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;

/**
 * @Author jay
 * @description 消息转换
 */
public class MessagesUtil {

    private MessagesUtil() {

    }

    public static String message(String code,Object ...args) {
        if(StringUtils.isEmpty(code)) {
            return code;
        }
        MessageSource messageSource = SpringUtil.getBean(MessageSource.class);
        return messageSource.getMessage(code, args, "未知消息", LocaleContextHolder.getLocale());
    }
}
